name = "Hello, World!"
# 切片语法：[起始索引:结束索引:步长] 
# 步长为负数时，从右往左取字符串, 起始索引和结束索引可以省略，省略时从左往右取字符串,步长可以省略，省略时默认为1
print(name[0:5:1])  # 输出 "Hello"
print(name[0:5:2])  # 输出 "Hlo"
print(name[::2])  # 输出 "Hlo ol!"
print(name[::-1])  # 输出 "!dlroW ,olleH" 
print(name[-1:3:-1]) # 输出 "!dlroW ,olleH"
print(name[1:3:-1]) # 输出 ""
print(name[2:-14:-1]) # 输出 "leH"